package com.wbao.dianniu.update;


import java.util.LinkedList;

/**
 * 积分改变处理类
 * <p>
 * Created by yejianjun on 2018/1/1.
 */

public class ScoreChangeManager {

    private static LinkedList<IScoreChangeListener> mListener;
    private static ScoreChangeManager instance;

    public static ScoreChangeManager getInstance() {
        if (null == instance) {
            mListener = new LinkedList<IScoreChangeListener>();
            instance = new ScoreChangeManager();
        }
        return instance;
    }

    private ScoreChangeManager() {
    }

    public interface IScoreChangeListener {

        public void updateScore();

    }

    public void addScoreChangeListener(IScoreChangeListener listener) {
        mListener.add(listener);
    }

    public void removeScoreChangeListener(IScoreChangeListener listener) {
        mListener.remove(listener);
    }

    public void updateScore() {
        for (int i = 0; i < mListener.size(); i++) {
            mListener.get(i).updateScore();
        }
    }


}
